import storage from "../../utils/storage/index.js"

export default {
    state: {
        isIndexPage: false,
        isArticlePage: false,
        greatBoxShow: false,
        loadBoxLoaded: false,
        consoleIsShow: false,
        siteMusicPlay: false,
        musicFirstPlay: false,
        siteRightMenuShow: false,
        siteRightMenuXPx: 0,
        siteRightMenuYPx: 0,
        siteCookiesWindowClassShow: true,
        siteCookiesWindowStyleShow: true,
        navToTopShow: false,
        toggleMenuClick: false,
        siteKeyBoardToggle: storage.data.get("SITE_KEY_BOARD_TOGGLE") || false,
        siteHideAside: storage.data.get("SITE_HIDE_ASIDE") || false,
        commentBarrage: storage.data.get("SITE_COMMENT_BARRAGE") || false,
        siteThemeMode: storage.data.get("SITE_THEME_MODE") || 'dark',
    },
    mutations: {
        SET_IS_INDEX_PAGE(state, isIndexPage) {
            state.isIndexPage = isIndexPage;
        },
        SET_IS_ARTICLE_PAGE(state, isArticlePage) {
            state.isArticlePage = isArticlePage;
        },
        SET_GREAT_BOX_SHOW(state, greatBoxShow) {
            state.greatBoxShow = greatBoxShow;
        },
        SET_LOAD_BOX_LOADED(state, loadBoxLoaded) {
            state.loadBoxLoaded = loadBoxLoaded;
        },
        SET_CONSOLE_IS_SHOW(state, consoleIsShow) {
            state.consoleIsShow = consoleIsShow;
        },
        SET_SITE_MUSIC_PLAY(state, siteMusicPlay) {
            state.siteMusicPlay = siteMusicPlay;
        },
        SET_MUSIC_FIRST_PLAY(state, musicFirstPlay) {
            state.musicFirstPlay = musicFirstPlay;
        },
        SET_SITE_RIGHT_MENU_SHOW(state, siteRightMenuShow) {
            state.siteRightMenuShow = siteRightMenuShow;
        },
        SET_SITE_RIGHT_MENU_XPX(state, siteRightMenuXPx) {
            state.siteRightMenuXPx = siteRightMenuXPx;
        },
        SET_SITE_RIGHT_MENU_YPX(state, siteRightMenuYPx) {
            state.siteRightMenuYPx = siteRightMenuYPx;
        },
        SET_SITE_COOKIES_WINDOW_CLASS_SHOW(state, siteCookiesWindowClassShow) {
            state.siteCookiesWindowClassShow = siteCookiesWindowClassShow;
        },
        SET_SITE_COOKIES_WINDOW_STYLE_SHOW(state, siteCookiesWindowStyleShow) {
            state.siteCookiesWindowStyleShow = siteCookiesWindowStyleShow;
        },
        SET_NAV_TO_TOP_SHOW(state, navToTopShow) {
            state.navToTopShow = navToTopShow;
        },
        SET_SITE_KEY_BOARD_TOGGLE(state, siteKeyBoardToggle) {
            state.siteKeyBoardToggle = siteKeyBoardToggle;
            storage.data.set("SITE_KEY_BOARD_TOGGLE", state.siteKeyBoardToggle)
        },
        SET_TOGGLE_MENU_CLICK(state, toggleMenuClick) {
            state.toggleMenuClick = toggleMenuClick;
        },
        SET_SITE_HIDE_ASIDE(state, siteHideAside) {
            state.siteHideAside = siteHideAside;
            storage.data.set("SITE_HIDE_ASIDE", state.siteHideAside)
        },
        SET_SITE_COMMENT_BARRAGE(state, commentBarrage) {
            state.commentBarrage = commentBarrage;
            storage.data.set("SITE_COMMENT_BARRAGE", state.commentBarrage)
        },
        SET_SITE_THEME_MODE(state, siteThemeMode) {
            state.siteThemeMode = siteThemeMode;
            storage.data.set("SITE_THEME_MODE", state.siteThemeMode)
        },
    },
    getters: {
        getIsIndexPage: (state) => {
            return state.isIndexPage;
        },
        getIsArticlePage: (state) => {
            return state.isArticlePage;
        },
        getSiteMusicPlay: (state) => {
            return state.siteMusicPlay;
        },
        getMusicFirstPlay: (state) => {
            return state.musicFirstPlay;
        },
        getSiteRightMenuShow: (state) => {
            return state.siteRightMenuShow;
        },
        getSiteRightMenuXPx: (state) => {
            return state.siteRightMenuXPx;
        },
        getSiteRightMenuYPx: (state) => {
            return state.siteRightMenuYPx;
        },
        getCookiesWindowClassShow: (state) => {
            return state.siteCookiesWindowClassShow;
        },
        getCookiesWindowStyleShow: (state) => {
            return state.siteCookiesWindowStyleShow;
        },
        getNavToTopShow: (state) => {
            return state.navToTopShow;
        },
        getSiteKeyBoardToggle: (state) => {
            return state.siteKeyBoardToggle;
        },
        getToggleMenuClick: (state) => {
            return state.toggleMenuClick;
        },
        getSiteHideAside: (state) => {
            return state.siteHideAside;
        },
        getCommentBarrage: (state) => {
            return state.commentBarrage;
        },
        getSiteThemeMode: (state) => {
            return state.siteThemeMode;
        },
    }
}